package com.ValueObjects;

import java.io.DataInputStream;
import java.io.IOException;
import java.util.Date;
import java.util.Hashtable;
import java.util.Vector;

public class Sessao {
    
    private int id_sessao;
    
    public String horario;
    
    private Sala sala;
    
    private float valor;
    
    private Hashtable compras;
       
    public int getId_sessao() {
        return id_sessao;
    }
    
    public void setId_sessao(int id_sessao) {
        this.id_sessao = id_sessao;
    }
    
    public Sala getSala() {
        return sala;
    }
    
    public void setSala(Sala sala) {
        this.sala = sala;
    }
    
    public Hashtable getCompras() {
        return compras;
    }
    
    public void setCompras(Hashtable compras) {
        this.compras = compras;
    }
    
    public float getValor() {
        return valor;
    }
    
    public void setValor(float valor) {
        this.valor = valor;
    }
    
    public static Vector getVector(DataInputStream dataIn, int itNum) {
        Vector v = new Vector();
        try {
            for(int i = 0; i < itNum; i++) {
                Sessao s = new Sessao();
                
                s.id_sessao = dataIn.readInt();
                s.valor = dataIn.readFloat();
                s.horario = dataIn.readUTF();
                
                Sala sl = new Sala();
                sl.setId_sala(dataIn.readInt());
                sl.setNome_sala(dataIn.readUTF());
                
                s.setSala(sl);
                
                v.addElement(s);
            }
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        return v;
    }
    
}